<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<html>
<head>
<%@ include file="common.jsp"%>

<title><%=proName%></title>
<link type="text/css" rel="stylesheet"
	href="<%=rootPath%>/css/manage/selectResult.css" />
<link type="text/css" rel="stylesheet"
	href="<%=rootPath%>/css/manage/materialEdit.css" />
<script type="text/javascript" src="<%=rootPath%>/js/manage/wxMaterialEditNews.js"></script>
</head>

<body>
	<jsp:include page="./menu.jsp"></jsp:include>
	<div id="body">
		<div id="navTop">
			<div class="bg_left"></div>
			<div class="bg_main"></div>
			<div class="bg_right"></div>
		</div>
		<div id="userManager">
			<table width="100%" cellpadding="0" cellspacing="0" border="0"
				class="maintable">
				<tr>
					<th colspan="4" align="left" valign="middle">
						<table cellpadding="0" cellspacing="0">
							<tr>
								<th><span id="search_icon" class="search_icon"></span></th>
								<th height="30px"><span style="margin-left: 2px;">素材管理</span>
								</th>
							</tr>
						</table>
					</th>
				</tr>
				<tr>
					<td colspan="4" align="left" valign="middle">
						<table cellpadding="0" cellspacing="0">
							<tr>
								<th height="30px"><input id="tab_news" type="button"
									onclick="goToManagePage('${appid}')"
									class="ui-button ui-widget ui-state-default ui-corner-all"
									role="button" aria-disabled="false" value="图文消息"
									onmouseover="this.style.background='#FFF18B'"
									onmouseout="this.style.background='#F1EDD2'"
									style="background: #FFF18B" /></th>
<!-- 								<th height="30px"><input id="tab_image" type="button" -->
<!-- 									onclick="addManyArticles()" -->
<!-- 									class="ui-button ui-widget ui-state-default ui-corner-all" -->
<!-- 									role="button" aria-disabled="false" value="图片库" -->
<!-- 									onmouseover="this.style.background='#FFF18B'" -->
<!-- 									onmouseout="this.style.background='#F1EDD2'" disabled="disabled"/></th> -->
<!-- 								<th height="30px"><input id="reset" type="button" -->
<!-- 									onclick="addManyArticles()" -->
<!-- 									class="ui-button ui-widget ui-state-default ui-corner-all" -->
<!-- 									role="button" aria-disabled="false" value="语音" -->
<!-- 									onmouseover="this.style.background='#FFF18B'" -->
<!-- 									onmouseout="this.style.background='#F1EDD2'" disabled="disabled"/></th> -->
<!-- 								<th height="30px"><input id="reset" type="button" -->
<!-- 									onclick="addManyArticles()" -->
<!-- 									class="ui-button ui-widget ui-state-default ui-corner-all" -->
<!-- 									role="button" aria-disabled="false" value="视频" -->
<!-- 									onmouseover="this.style.background='#FFF18B'" -->
<!-- 									onmouseout="this.style.background='#F1EDD2'" disabled="disabled"/></th> -->
							</tr>
						</table>
					</td>
				</tr>
				<tr>
					<td>
						<table id="newRule" class="maintable" width="95%"
							cellpadding="0px" cellspacing="25px"
							style="margin-left: auto; border: 0px #ccc solid; margin-bottom: 20px; display: block; float: left;">
							<tr><td>修改图文消息</td></tr>
							<tr>
								<td id="" valign="top" style="width: 33%">

									<table id="newRule" class="maintable" width="100%"
										cellpadding="0px" cellspacing="25px"
										style="margin-left: auto; margin-bottom: 20px;">
										<tr>
											<td id="col_1" valign="top" style="width: 33%">
												<table id="articleModel" class="maintable" width="100%" style="margin-left: 3%; border: 1px #ccc solid; margin-bottom: 20px;">
													<c:forEach items="${material.articleList}" var="article" varStatus="s">
														<c:if test="${article.order == 0 }">
															<tr id="article_0" style="height: 174px;">
																<td>
																	<div class="firstaticle"  onmouseover="showEdit('article_edit_0')" onmouseout="hideEdit('article_edit_0')">
																		<table width="100%">
																			<tr>
																				<th>
																					<div class="content" >
																						<img class="item_img" id="article_img_0" src="<%=rootPath%>${article.picUrl}" />
																						<div id="article_thumb_0" class="cover" style="display: none">封面</div>
																						<div class="title" >
																							<h2 id="article_title_0">${article.title }</h2>
																						</div>
																					</div>
																				</th>
																			</tr>
																		</table>
																		<div class="eidt_mask" id="article_edit_0">
																			<a href="javascript:editArticle('0')">编辑</a>
																		</div>
																	</div>
																</td>
															</tr>
														</c:if>
														<c:if test="${article.order != 0 }">
															<tr id="article_${s.index }" style="height: 80px;position: relative;" >
																<td >
																	<div class="article_item" onmouseover="showEdit('article_edit_${s.index }')" onmouseout="hideEdit('article_edit_${s.index }')">
																		<table width="100%" >
																			<tr>
																				<td><div style="width: 172px;overflow: hidden;max-height: 42px;">
																					<h2 id="article_title_${s.index }" class="title">${article.title}</h2>
																					</div>
																				</td>
																				<td width="30%">
																					<div style="height: 78px;overflow: hidden;">
																						<img class="item_img" id="article_img_${s.index }" src="<%=rootPath %>${article.picUrl}"  />
																						<div id="article_thumb_${s.index }" class="thumb" style="display: none;">缩略图</div>
																					</div>
																				</td>
																			</tr>
																		</table>
																		<div class="edit_item" id="article_edit_${s.index }">
																			<a href="javascript:editArticle('${s.index }')">编辑</a>&nbsp;&nbsp;&nbsp;<a href="javascript:deleteArticle('${s.index }')">删除</a>
																		</div>
																	</div>
																</td>
															</tr>
														</c:if>
													</c:forEach>
													<tr>
														<td style="cursor: pointer;border: 1px dotted black;background: #CCC" align="center" onclick="addNewArticle()"><font size="16">+</font></td>
													</tr>
												</table>
											</td >
											<td id="col_2" valign="top" style="width: 66%">
												<form id="materialForm" action="<%=rootPath %>/material/update.mge" method="post" class="form">
												<input type="hidden" name="id" value="${material.id }"/>
												<input type="hidden" name="materialType" value="news"/>
												<c:forEach items="${material.articleList}" var="article" varStatus="s">
													<table id="form_article_${s.index}" class="maintable" width="100%"  <c:if test="${article.order == 0 }">style="display: block;"</c:if><c:if test="${article.order != 0 }">style="display: none;"</c:if>>
														<tr style="height: 30px;">
															<td>标题:</td>
															<td>
																<input id="title_${s.index}" type="text" name="articles[${s.index}].title" onkeyup="showTitle('${s.index}')" value="${article.title }"/>
																<input type="hidden" name="articles[${s.index}].order" value="${s.index}"/>
																<span class="hint" id="hint_title_${s.index}"></span>
															</td>
														</tr>
														<tr style="height: 30px;">
															<td>描述:</td>
															<td >
																<textarea id="description_${s.index}" rows="2" cols="30" name="articles[${s.index}].description">${article.description }</textarea>
																<span class="hint" id="hint_description_${s.index}"></span>
															</td> 
														</tr>
														<tr style="height: 30px;">
															<td>封面:</td>
															<td>
																<input type="file" id="file_${s.index}" name="fileToUpload" onchange="uploadPic('file_${s.index}')" class="file"/>
																<input type="button" onclick="selectfile('file_${s.index}')" class="ui-button ui-widget ui-state-default ui-corner-all" role="button" aria-disabled="false" value="上传"/>
																<input id="pic_${s.index}" type="hidden" name="articles[${s.index}].picUrl" value="${article.picUrl }"/>
																<span class="hint" id="hint_cover_${s.index}"></span>
															</td>
														</tr>
														<tr id="showCover_${s.index}" style="height: 80px;">
															<td>&nbsp;</td>
															<td>
																<div id="showPic_${s.index}" style="height: 80px;overflow: hidden;float: left;">
																<img id="img_${s.index}" src="<%=rootPath %>${article.picUrl}" width="70px" />
																</div>
																<a href="javascript:deletePic('pic_${s.index}')" style="line-height: 80px;margin-left: 15px;">删除</a>
															</td>
														</tr>
														<tr style="height: 30px;">
															<td>连接地址:</td>
															<td><input id="url_${s.index}" type="text" name="articles[${s.index}].url" value="${article.url }"/><span class="hint" id="hint_url_${s.index}"></span></td>
														</tr>
													</table>
												</c:forEach>
												
												</form>
											</td>
										</tr>
										<tr><td align="center" colspan="2" style="border-top: 1px solid #ccc;padding-top: 5px;">
											<input id="reset" type="button"
											onclick="updateManyArticles()"
											class="ui-button ui-widget ui-state-default ui-corner-all"
											role="button" aria-disabled="false" value="保存"
											onmouseover="this.style.background='#FFF18B'"
											onmouseout="this.style.background='#F1EDD2'" />
										</td></tr>
									</table> <!-- tianjia guize biao end -->
									<iframe id="fileUploadResult" name="fileUploadResult" style="display: none;"></iframe>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
			<div id="pagernav"></div>
			<div id="rolesDialog" style="display: none; height: 300px">
				<div id="treeScroll">
					<div id="treebox_group"></div>
				</div>
			</div>
		</div>
	</div>
	<jsp:include page="./footer.jsp"></jsp:include>
</body>
</html>
